lib = {}
function lib.GetTileByIndex(image, index, tw,th)
	local maxcol = math.floor(image:getWidth() / tw)
	local maxrow = math.floor(image:getHeight() / th)
	local _x = index % maxcol
	local _y = math.floor(index / maxcol)
	return {x=_x*tw, y=_y*th, w=tw,h=th}
end

CurrentDirectory = "src/"
function chdir(dir)
	CurrentDirectory = dir
end

function Import(file)
	xpcall(function() 
		--love.filesystem.load(file)()
		require(CurrentDirectory..file)
		print(file,"-","loaded")
	end,
	function(e)
		print(e)
		return e
	end)
end

Import "lib/libfiles.lua"

Merge = table.Merge
Copy = table.Copy

